Smart tuple class generation for split smart tuples

ABSTRACT

A smart tuple manager includes a mechanism for splitting a smart tuple, and for automatically generating one or more classes from existing classes when a smart tuple is split. When a first smart tuple is split into second and third new smart tuples, classes for the second and third smart tuples are automatically generated from the class for the first smart tuple. The classes for the second and third smart tuples are subsets of the data elements and code segments in the first class. After a class is automatically generated, new code segments may be added to the class as needed.

BACKGROUND 1. Technical Field

This disclosure generally relates to streaming applications, and morespecifically relates to the automatic generation of classes for splitsmart tuples in a streaming application.

2. Background Art

Streaming applications are known in the art, and typically includemultiple operators coupled together in a flow graph that processstreaming data in near real-time. An operator typically takes instreaming data in the form of data tuples, operates on the data tuplesin some fashion, and outputs the processed data tuples to the nextoperator. Streaming applications are becoming more common due to thehigh performance that can be achieved from near real-time processing ofstreaming data.

Early streaming applications processed data tuples that included onlydata. More recent work has generated the concept of a “smart tuple”,where a tuple can include not only data, but embedded code segments forprocessing the data. The advantage of a smart tuple is the tuple itselfmay include embedded code for processing data in the tuple. Because asmart tuple includes embedded code, the smart tuple must have acorresponding class that defines both the data and the embedded code inthe smart tuple. When smart tuples are split or merged, a programmermust manually generate a class for each new type of smart tuple.

BRIEF SUMMARY

A smart tuple manager includes a mechanism for splitting a smart tuple,and for automatically generating one or more classes from existingclasses when a smart tuple is split. When a first smart tuple is splitinto second and third new smart tuples, classes for the second and thirdsmart tuples are automatically generated from the class for the firstsmart tuple. The classes for the second and third smart tuples aresubsets of the data elements and code segments in the first class. Aftera class is automatically generated, new code segments may be added tothe class as needed.

The foregoing and other features and advantages will be apparent fromthe following more particular description, as illustrated in theaccompanying drawings.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWING(S)

The disclosure will be described in conjunction with the appendeddrawings, where like designations denote like elements, and:

FIG. 1 is a block diagram of a computer system that includes a smarttuple manager that merges or splits smart tuples and automaticallygenerates classes for smart tuples as needed;

FIG. 2 is a block diagram of a sample streaming application thatincludes multiple operators that process data tuples, including smarttuples;

FIG. 3 shows a sample data tuple that includes only data elements;

FIG. 4 shows a sample smart tuple that includes both data elements andembedded code in the form of methods that operate on the data elements;

FIG. 5 is a table showing that for each smart tuple type, acorresponding class is required;

FIG. 6 shows two smart tuples A and B that can be merged by the smarttuple manager in the streams manager;

FIG. 7 is a flow diagram of a method for merging smart tuples andautomatically generating a class for the resulting merged smart tuple;

FIG. 8 shows a smart tuple C created by merging the smart tuples A and Bin FIG. 6 using method 700 shown in FIG. 7;

FIG. 9 is a flow diagram of a method for splitting a smart tuple intomultiple new smart tuples and for automatically generating classes forthe new smart tuples; and

FIG. 10 shows smart tuples D and E created by splitting the smart tupleC in FIG. 8.

DETAILED DESCRIPTION

The disclosure and claims herein are directed to a smart tuple managerthat includes a mechanism for splitting a smart tuple, and forautomatically generating one or more classes from existing classes whena smart tuple is split. When a first smart tuple is split into secondand third new smart tuples, classes for the second and third smarttuples are automatically generated from the class for the first smarttuple. The classes for the second and third smart tuples are subsets ofthe data elements and code segments in the first class. After a class isautomatically generated, new code segments may be added to the class asneeded.

Referring to FIG. 1, a computer system 100 is one suitableimplementation of a server computer system that includes a smart tuplemanager as described in more detail below. Server computer system 100 isan IBM POWER8 computer system. However, those skilled in the art willappreciate that the disclosure herein applies equally to any computersystem, regardless of whether the computer system is a complicatedmulti-user computing apparatus, a single user workstation, a laptopcomputer system, a tablet computer, a phone, or an embedded controlsystem. As shown in FIG. 1, computer system 100 comprises one or moreprocessors 110, a main memory 120, a mass storage interface 130, adisplay interface 140, and a network interface 150. These systemcomponents are interconnected through the use of a system bus 160. Massstorage interface 130 is used to connect mass storage devices, such aslocal mass storage device 155, to computer system 100. One specific typeof local mass storage device 155 is a readable and writable CD-RW drive,which may store data to and read data from a CD-RW 195. Another suitabletype of local mass storage device 155 is a card reader that receives aremovable memory card, such as an SD card, and performs reads and writesto the removable memory. Yet another suitable type of local mass storagedevice 155 is a thumb drive.

Main memory 120 preferably contains data 121, an operating system 122,and a streams manager 123. Data 121 represents any data that serves asinput to or output from any program in computer system 100. Operatingsystem 122 is a multitasking operating system, such as AIX or LINUX. Thestreams manager 123 is software that provides a run-time environmentthat executes a streaming application 124. The streaming application 124comprises a flow graph that includes processing elements that includeoperators that process data tuples, including smart tuples. The streamsmanager 123 includes a smart tuple manager 125 that includes amerge/split mechanism 126 and an automatic class generation mechanism127. The merge/split mechanism 126 determines when a merge of smarttuples or a split of a smart tuple is needed, and the automatic classgeneration mechanism 127 automatically generates one or more classes forthe new smart tuples created by the merge/split mechanism 126, asdiscussed in more detail below.

Smart tuple manager 125 is shown in FIG. 1 as part of the streamsmanager, and is preferably a service that can merge/split smart tuplesand automatically generated the needed classes, as required. However,the smart tuple manager 125 could reside elsewhere as well. For example,the smart tuple manager 125 could be part of a smart tuple. Thedisclosure and claims herein expressly extend to any suitable locationand implementation for the smart tuple manager.

Computer system 100 utilizes well known virtual addressing mechanismsthat allow the programs of computer system 100 to behave as if they onlyhave access to a large, contiguous address space instead of access tomultiple, smaller storage entities such as main memory 120 and localmass storage device 155. Therefore, while data 121, operating system122, and streams manager 123 are shown to reside in main memory 120,those skilled in the art will recognize that these items are notnecessarily all completely contained in main memory 120 at the sametime. It should also be noted that the term “memory” is used hereingenerically to refer to the entire virtual memory of computer system100, and may include the virtual memory of other computer systemscoupled to computer system 100.

Processor 110 may be constructed from one or more microprocessors and/orintegrated circuits. Processor 110 executes program instructions storedin main memory 120. Main memory 120 stores programs and data thatprocessor 110 may access. When computer system 100 starts up, processor110 initially executes the program instructions that make up operatingsystem 122. Processor 110 also executes the streams manager 123, whichexecutes the streaming application 124 and the smart tuple manager 125.

Although computer system 100 is shown to contain only a single processorand a single system bus, those skilled in the art will appreciate that astreams manager as described herein may be practiced using a computersystem that has multiple processors and/or multiple buses. In addition,the interfaces that are used preferably each include separate, fullyprogrammed microprocessors that are used to off-load compute-intensiveprocessing from processor 110. However, those skilled in the art willappreciate that these functions may be performed using I/O adapters aswell.

Display interface 140 is used to directly connect one or more displays165 to computer system 100. These displays 165, which may benon-intelligent (i.e., dumb) terminals or fully programmableworkstations, are used to provide system administrators and users theability to communicate with computer system 100. Note, however, thatwhile display interface 140 is provided to support communication withone or more displays 165, computer system 100 does not necessarilyrequire a display 165, because all needed interaction with users andother processes may occur via network interface 150.

Network interface 150 is used to connect computer system 100 to othercomputer systems or workstations 175 via network 170. Network interface150 broadly represents any suitable way to interconnect electronicdevices, regardless of whether the network 170 comprises present-dayanalog and/or digital techniques or via some networking mechanism of thefuture. Network interface 150 preferably includes a combination ofhardware and software that allows communicating on the network 170.Software in the network interface 150 preferably includes acommunication manager that manages communication with other computersystems 175 via network 170 using a suitable network protocol. Manydifferent network protocols can be used to implement a network. Theseprotocols are specialized computer programs that allow computers tocommunicate across a network. TCP/IP (Transmission ControlProtocol/Internet Protocol) is an example of a suitable network protocolthat may be used by the communication manager within the networkinterface 150. In one suitable implementation, the network interface 150is a physical Ethernet adapter.

The present invention may be a system, a method, and/or a computerprogram product at any possible technical detail level of integration.The computer program product may include a computer readable storagemedium (or media) having computer readable program instructions thereonfor causing a processor to carry out aspects of the present invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, configuration data for integrated circuitry, oreither source code or object code written in any combination of one ormore programming languages, including an object oriented programminglanguage such as Smalltalk, C++, or the like, and procedural programminglanguages, such as the “C” programming language or similar programminglanguages. The computer readable program instructions may executeentirely on the user's computer, partly on the user's computer, as astand-alone software package, partly on the user's computer and partlyon a remote computer or entirely on the remote computer or server. Inthe latter scenario, the remote computer may be connected to the user'scomputer through any type of network, including a local area network(LAN) or a wide area network (WAN), or the connection may be made to anexternal computer (for example, through the Internet using an InternetService Provider). In some embodiments, electronic circuitry including,for example, programmable logic circuitry, field-programmable gatearrays (FPGA), or programmable logic arrays (PLA) may execute thecomputer readable program instructions by utilizing state information ofthe computer readable program instructions to personalize the electroniccircuitry, in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the blocks may occur out of theorder noted in the Figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

Referring to FIG. 2, an extremely simplified streaming application 200is shown. The streaming application 200 includes nine operators Op1-Op9.Op1 is a source operator that produces data tuples and passes datatuples to Op2 for processing. Op2 processes the data tuples it receivesfrom Op1 and routes some of those tuples to Op3 and others to Op4. Op3operates on tuples it receives from Op2 and sends the resulting tuplesto Op4. Op4 operates on tuples it receives from Op3 and sends theresulting tuples to Op5. Op5 operates on tuples it receives from Op4 andsends the resulting tuples to Op9. Op6 operates on tuples it receivesfrom Op2 and sends the resulting tuples to Op7. Op7 operates on tuplesit receives from Op6 and sends the resulting tuples to Op8. Op8 operateson tuples it receives from Op7 and sends the resulting tuples to Op9.Op9 receives tuples from both Op5 and Op8, and is a sink for thosetuples.

Early streaming applications processed tuples that included only data,such as tuple A shown in FIG. 3. Tuple A is shown to have three dataelements denoted a1, a2 and a3. More recent developments in streamingapplications have recognized that a tuple can include not only data, butembedded code segments as well that allow the tuple to have intelligencefor processing one or more of the data elements in the tuple. Such atuple has been called a “smart tuple” because it contains not only data,but intelligence for processing the data as well. An example of a smarttuple A is shown in FIG. 4 to include the same data elements a1, a2 anda3 shown in FIG. 3, but additionally includes a method m1 that performssome operation on data element a1, and a method m2 that performs someoperation on data elements a2 and a3. Note the operators shown in FIG. 2could process a data-only tuple such as shown in FIG. 3 or could processa smart tuple such as shown in FIG. 4. Any or all of the operators couldprocess smart tuples, as needed by the particular streaming application200.

Putting embedded code into a tuple requires each type of smart tuple tohave a corresponding class that defines both the data and the embeddedcode in the smart tuple. Thus, as shown in table 500 in FIG. 5, eachsmart tuple type A, B, C, D and E has a corresponding class Class_A,Class_B, Class_C, Class_D and Class_E. When a smart tuple is split intotwo new smart tuples, a programmer typically must manually createclasses for the two new smart tuples. Similarly, when two smart tuplesare merged into a new smart tuple, a programmer must manually create aclass for the new smart tuple. The smart tuple manager 125 disclosedherein simplifies the process of class creation by including anautomatic class generation mechanism 127 that automatically generatesany needed classes for smart tuples as a result of a merge of smarttuples or a split of smart tuples. Note the automatic class generationmechanism 127 can automatically generate classes that are used atrun-time. In addition, the automatic class generation mechanism 127 cangenerate classes in an integrated development environment that couldthen be presented to a programmer for review and approval. Thus, theautomatic class generation mechanism 127 can generate both source codeand executable object code, as needed.

FIG. 6 shows two smart tuples A and B, with smart tuple A including dataelements a1, a2 and a3, and a method m1 that operates on data element a1and a method m2 that operates on data elements a2 and a3. Smart tuple Bincludes data elements b1, b2 and b3, and a method m3 that operates ondata element b3.

FIG. 7 shows a method 700 that is preferably performed by the automaticclass generation mechanism 127 in FIG. 1. Method 700 begins when twosmart tuples need to be merged (step 710), as determined by themerge/split mechanism 126 in FIG. 1. The classes for the smart tuples tobe merged are read (steps 720 and 730). In this specific example, weassume the two smart tuples A and B shown in FIG. 6 need to be merged.This means the class corresponding to smart tuple A is read in step 720,and the class corresponding to smart tuple B is read in step 730. Next,a superset class is created for the resulting merged smart tuple C,where the superset class is a merge of the classes for smart tuple A andsmart tuple B (step 740). If the merge creates any conflicts in names ofdata elements or methods, the conflicts are resolved by renaming one orboth of the data elements or methods that have the same name (step 750).Method 700 is then done. The resulting smart tuple C is shown in FIG. 8,and the corresponding class for the merged tuple C will include all dataelements a1, a2, a3, b1, b2, b3 m1, m2 and m3 to correspond to thesuperset of data elements and methods shown in FIG. 8 for the twooriginal smart tuples A and B shown in FIG. 6. While the specificexample in FIGS. 6-8 shows steps for merging two smart tuples, oneskilled in the art will realize that a similar method could be used tomerge three or more smart tuples.

FIG. 9 shows a method 900 that is preferably performed by the automaticclass generation mechanism 127 in FIG. 1. Method 900 begins when a smarttuple needs to be split into two or more smart tuples (step 910). Theclass for the smart tuple to be split is read (step 920). Adetermination is made regarding how to split the data elements andmethods in class C for the smart tuple C (step 930). For example,downstream operators on each side of the split could be analyzed todetermine what attributes and/or methods they require. According to thedetermined split, a class D is automatically generated for a smart tupleD that is a subset of data elements and methods in class C (step 940).According to the determined split, a class E is automatically generatedfor a smart tuple E that is a subset of data elements and methods inclass C (step 950). One or more methods could be added to class D and/orclass E, if needed (step 960). For example, let's assume the determinedsplit results in a first tuple with only data elements and a secondtuple that is a smart tuple with both data elements and embedded code.One or more methods could be added to either or both of these tuples instep 960, as needed. While the specific example in FIGS. 8-10 showssteps for splitting a smart tuple into two smart tuples, one skilled inthe art will realize that a similar method could be used to split asmart tuple into three or more smart tuples.

Let's assume the tuple C in FIG. 8 that was created by merging tuples Aand B in FIG. 6 now needs to be split. Using method 900 in FIG. 9, twonew smart tuples D and E can be created as shown in FIG. 10, and theircorresponding classes can also be automatically generated that definetheir respective data elements and methods. Thus, for smart tuple D inFIG. 10, a class D could be created that defines data element a1 andmethod m1 that operates on data element a1. Similarly, for smart tuple Ein FIG. 10, a class E could be created that defines data element a2, a3,b1, b2, b3, and method m2 that operates on data elements a2 and a3 andmethod m3 that operates on data element b3.

While code is not shown for the classes herein, a programmer of ordinaryskill in the art will readily understand how the classes herein areautomatically generated based on the data elements and the methods inthe smart tuples being merged or split. The automatic class generationmechanism 127 disclosed herein can generate both the source code of thenew class and the runtime code to support the new class.

A smart tuple manager includes a mechanism for splitting a smart tuple,and for automatically generating one or more classes from existingclasses when a smart tuple is split. When a first smart tuple is splitinto second and third new smart tuples, classes for the second and thirdsmart tuples are automatically generated from the class for the firstsmart tuple. The classes for the second and third smart tuples aresubsets of the data elements and code segments in the first class. Aftera class is automatically generated, new code segments may be added tothe class as needed.

One skilled in the art will appreciate that many variations are possiblewithin the scope of the claims. Thus, while the disclosure isparticularly shown and described above, it will be understood by thoseskilled in the art that these and other changes in form and details maybe made therein without departing from the spirit and scope of theclaims.

1. An apparatus comprising: at least one processor; a memory coupled tothe at least one processor; and a streams manager residing in the memoryand executed by the at least one processor, the streams managerexecuting a streaming application comprising a flow graph that includesa plurality of operators that process a plurality of smart data tuples,each smart data tuple comprising: a plurality of data elements; and atleast one embedded software code segment that, when executed, performsan operation on at least one of the plurality of data elements; whereinthe streaming application comprises a plurality of classes that eachdefines the plurality of data elements and the at least one embeddedsoftware code segment for each type of smart tuple; and wherein thestreams manager determines when a split of a first smart tuple is neededinto second and third smart tuples, and in response, automaticallygenerates classes for the second and third smart tuples from a classcorresponding to the first smart tuple.
 2. The apparatus of claim 1wherein the classes for the second and third smart tuples each comprisea subset of data elements and embedded software code segments that existin the class corresponding to the first smart tuple.
 3. The apparatus ofclaim 2 wherein the streams manager adds at least one embedded softwarecode segment to the class for second smart tuple.
 4. The apparatus ofclaim 2 wherein the streams manager adds at least one embedded softwarecode segment to the class for the third smart tuple.
 5. Acomputer-implemented method executed by at least one processor forexecuting streaming applications, the method comprising: executing astreaming application comprising a flow graph that includes a pluralityof operators that process a plurality of smart data tuples, each smartdata tuple comprising: a plurality of data elements; and at least oneembedded software code segment that, when executed, performs anoperation on at least one of the plurality of data elements; wherein thestreaming application comprises a plurality of classes that each definesthe plurality of data elements and the at least one embedded softwarecode segment for each type of smart tuple; and determining when a splitof a first smart tuple is needed into second and third smart tuples, andin response, automatically generating classes for the second and thirdsmart tuples from a class corresponding to the first smart tuple.
 6. Themethod of claim 5 wherein the classes for the second and third smarttuples each comprise a subset of data elements and embedded softwarecode segments that exist in the class corresponding to the first smarttuple.
 7. The method of claim 6 further comprising adding at least oneembedded software code segment to the class for second smart tuple. 8.The method of claim 6 further comprising adding at least one embeddedsoftware code segment to the class for the third smart tuple.
 9. Acomputer-implemented method executed by at least one processor forexecuting streaming applications, the method comprising: executing astreaming application comprising a flow graph that includes a pluralityof operators that process a plurality of smart data tuples, each smartdata tuple comprising: a plurality of data elements; and at least oneembedded software code segment that, when executed, performs anoperation on at least one of the plurality of data elements; wherein thestreaming application comprises a plurality of classes that each definesthe plurality of data elements and the at least one embedded softwarecode segment for each type of smart tuple; determining when a split of afirst smart tuple is needed into second and third smart tuples, and inresponse, automatically generating classes for the second and thirdsmart tuples from a class corresponding to the first smart tuple,wherein the classes for the second and third smart tuples each comprisea subset of data elements and embedded software code segments that existin the class corresponding to the first smart tuple; and determiningwhen a merge of a fourth smart tuple with a fifth smart tuple into asixth smart tuple is needed, and in response, automatically generating aclass for the sixth smart tuple from the classes corresponding to thefourth and fifth smart tuples, wherein the class for the sixth smarttuple comprises a superset of data elements and embedded software codesegments that exist in the classes corresponding to the fourth and fifthsmart tuples, wherein when a first data element in the fourth smarttuple has a same name as a second data element in the fifth smart tuple,renaming at least one of the first and second data elements; adding atleast one embedded software code segment to the class for the secondsmart tuple; and adding at least one embedded software code segment tothe class for the third smart tuple.
 10. The method of claim 9 furthercomprising: adding at least one embedded software code segment to theclass for the sixth smart tuple.